﻿#!/usr/bin/python
# -*- encoding: utf-8 -*-
'''
@File    : HttpApiTestWidget.py
@Desc    : 
@Version : 1.0
@Author  : echohelper 
@Email   : echohelper@qq.com
@WebSite : www.github.com/echohelper
@Time    : 2021/09/24 09:19:47
'''
# Start typing your code from here

from PyQt5 import QtCore, QtGui, QtWidgets

from module.demo.Ui_HttpApiTestWidget import Ui_Form
from module.network.demo.LoginTest import LoginTest


class HttpApiTestWidget(QtWidgets.QWidget):

    def __init__(self):
        super().__init__()
        self.ui = Ui_Form()
        self.ui.setupUi(self)

    def onBtnStop(self, checked:bool) -> None:
        print('onBtnStop')
        QtWidgets.QMessageBox.information(None, "info", "infomation")
        self.ui.textBrowser.append('test account login successful')

    def onBtnStart(self, checked:bool) -> None:
        print('onBtnStart')
        bRet = LoginTest().testAccountLoginPost('http://192.168.1.129:80/api/user/login', '{"clienttype":"pc","password":"123456","username":"abc"}')
        if bRet:
            print('test account login successful')
            self.ui.textBrowser.append('test account login successful')
        else:
            print('test account login failure')
            self.ui.textBrowser.append('test account login failure')

